/* See the file "LICENSE" for the full license governing this code. */

package com.plugandcare.graphyty.model;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Data model of glucose. Modeled using OpenEHR archetype
 * openEHR-EHR-OBSERVATION.lab_test-blood_glucose.v1.
 * 
 * @author Steven Mohr
 */
public class BloodGlucose extends VitalSign{
    /** Constant for unit "mg/dl". **/
    public static final String UNIT_MGDL = "mg/dl";

    private double bloodGlucose;

    public void setBloodGlucose(double bloodGlucose) {
        this.bloodGlucose = bloodGlucose;
    }

    public double getBloodGlucose() {
        return bloodGlucose;
    }

    /**
     * {@inheritDoc}
     */
    public String toString() {
        return "Glucose: " + bloodGlucose + "mg/dL (@" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date(getTimestamp())) + ")";
    }

    @Override
    public String getMeasurement() {
        return bloodGlucose + " " + unit;
    }
}
